<?php

/*
|--------------------------------------------------------------------------
| Application Routes
|--------------------------------------------------------------------------
|
| Here is where you can register all of the routes for an application.
| It is a breeze. Simply tell Lumen the URIs it should respond to
| and give it the Closure to call when that URI is requested.
|
*/

// O1 Member
$router->group([
    'prefix' => 'o1',
    'middleware' => [
        'app-auth:app_site',
        'app-authorize'
    ],
    'namespace' => 'Api\O1'
], function () use ($router) {

    // Auth
    $router->group(['prefix' => 'auth','namespace' => 'Auth'], function () use ($router) {
        $router->post('/login', 'LoginController@login');
        $router->post('/register', 'RegisterController@store');
    });

    // User
    $router->group(['prefix' => 'user','namespace' => 'User'], function () use ($router) {
        $router->post('/check/email', 'CheckController@email');
    });

    // Menu
    $router->group(['prefix' => 'menus'], function () use ($router) {
        $router->get('/', 'MenuController@index');
        $router->get('/position/{position}', 'MenuController@position');
    });

    // Page
    $router->group(['prefix' => 'pages'], function () use ($router) {
        $router->get('/{page_id}', 'PageController@show');
    });

    // Promo
    $router->group(['prefix' => 'promos'], function () use ($router) {
        $router->get('/', 'PromoController@index');
    });

    // Welcome
    $router->group(['prefix' => 'welcomes'], function () use ($router) {
        $router->get('/', 'WelcomeController@index');
    });

    // Pay
    $router->group(['prefix' => 'pay', 'namespace' => 'Pay'], function () use ($router) {
        $router->get('/ease/{order_id}', 'PayEaseController@pay');
    });

    // Registration
    $router->group(['prefix' => 'registration/fees'], function () use ($router) {
        $router->get('/', 'RegistrationFeeController@all');
    });


});

// UserCenter
$router->group([
    'prefix' => 'o1/uc',
    'middleware' => [
        'auth:api',
        'app-auth:app_site',
        'app-authorize',
        'scopes:user_member,app_site'
    ],
    'namespace' => 'Api\O1\UserCenter'],
    function () use ($router)
{

    // Test
    $router->group(['prefix' => 'tests'], function () use ($router) {
        $router->get('/', 'WelcomeController@index');
    });


    // OrderHotelReservation
    $router->group(['prefix' => 'order/hotel/reservations', 'namespace' => 'Order'], function () use ($router) {
        $router->get('/', 'HotelReservationController@index');
        $router->post('/', 'HotelReservationController@store');
        $router->get('/{id}', 'HotelReservationController@show');
//        $router->put('/{id}', 'HotelReservationController@update');
//        $router->delete('/{id}', 'HotelReservationController@destroy');
    });

    // Order
    $router->group(['prefix' => 'orders', 'namespace' => 'Order'], function () use ($router) {
        $router->get('/cancel/{id}', 'OrderController@cancel');
        $router->get('/paying/{order_id}', 'OrderController@paying');
    });
    
    // OrderRegistrationFee
    $router->group(['prefix' => 'order/registration/fees', 'namespace' => 'Order'], function () use ($router) {
        $router->get('/', 'RegistrationFeeController@index');
        $router->post('/', 'RegistrationFeeController@store');
        $router->get('/{id}', 'RegistrationFeeController@show');
//        $router->put('/{id}', 'RegistrationFeeController@update');
//        $router->delete('/{id}', 'RegistrationFeeController@destroy');
    });

    // Paper
    $router->group(['prefix' => 'papers', 'namespace' => 'Paper'], function () use ($router) {
        $router->get('/', 'PaperController@index');
        $router->post('/', 'PaperController@store');
        $router->get('/{id}', 'PaperController@show');
        $router->put('/{id}', 'PaperController@update');
        $router->delete('/{id}', 'PaperController@destroy');
    });

    // PaperAbstract
    $router->group(['prefix' => 'paper', 'namespace' => 'Paper'], function () use ($router) {

        // PaperAbstract
        $router->get('/abstracts', 'AbstractController@index');
//        $router->post('/abstracts', 'AbstractController@store');
//        $router->get('/abstracts/{abstract_id}', 'AbstractController@show');
//        $router->put('/abstracts/{abstract_id}', 'AbstractController@update');
//        $router->delete('/abstracts/{abstract_id}', 'AbstractController@destroy');

        // PaperFull
        $router->get('/fulls', 'FullController@index');
        $router->post('/{paper_id}/fulls', 'FullController@store');
//        $router->get('/fulls/{full_id}', 'FullController@show');
//        $router->put('/fulls/{full_id}', 'FullController@update');
//        $router->delete('/fulls/{full_id}', 'FullController@destroy');

        // PaperTheme
        $router->get('/themes', 'ThemeController@index');

    });

//    // PaperFull
//    $router->group(['prefix' => 'paper/fulls', 'namespace' => 'Paper'], function () use ($router) {
//
//    });

    // Member
    $router->group(['prefix' => 'members', 'namespace' => 'Member'], function () use ($router) {
        $router->post('/profile', 'ProfileController@profile');
        $router->post('/password', 'PasswordController@password');
    });

    // Visa
    $router->group(['prefix' => 'visas'], function () use ($router) {
        $router->get('/', 'VisaController@index');
        $router->post('/', 'VisaController@store');
        $router->get('/{id}', 'VisaController@show');
        $router->put('/{id}', 'VisaController@update');
        $router->delete('/{id}', 'VisaController@destroy');
    });
});